package task.manager;

import junit.framework.Assert;
import junit.framework.TestCase;

/**
 * Test class for Task class.
 * 
 * @author Harrison Saylor, Aaron Mead, Marc Huet, Greg Ruskin
 * @version 2
 */
public class TaskTest extends TestCase {
	
	Task testTask;
	Task testTask2;
	Task testTask3;
	
	/**
	 * Sets up variables for testing.
	 */
	public void setUp(){
		testTask = new Task("Test Task", 2, 2, 2013, 1, 1, "cat");
		testTask2 = new Task("Test Task", 2, 2, 2013, 1, 1, "cat", "georgia tech", "");
		testTask3 = new Task("Test Task", 2, 2, 2013, 1, 1, "cat", "your mom", "6387 Aarons Way");
	} // End of setUp() method.
	
	/**
	 * Tests the isCompleted() method in the Task class.
	 */
	public void testIsCompleted(){
		Assert.assertTrue("Task is complete when created",testTask.getIsCompleted()==false);
		testTask.setIsCompleted(true);
		Assert.assertTrue("Task complete doesn't return true when marked",testTask.isComplete()==true);
	} // End of testIsCompleted() method.
	
	/**
	 * Tests the isAfter() method in the Task class.
	 */
	public void testIsAfter(){
		Assert.assertTrue("Returns that a later year is before an earlier one",testTask.isAfter(2, 2, 2000)==true);
		Assert.assertTrue("Returns that a later month is before an earlier one",testTask.isAfter(1, 1, 2013)==true);
		Assert.assertTrue("Returns that a later day is before an earlier one",testTask.isAfter(2, 1, 2013)==true);
	} // End of testIsAfter() method.
	
	/**
	 * Tests the isBefore() method in the Task class.
	 */
	public void testIsBefore(){
		Assert.assertFalse("Returns that a later year is before an earlier one",testTask.isBefore(2, 2, 2000));
		Assert.assertFalse("Returns that a later month is before an earlier one",testTask.isBefore(1, 1, 2013));
		Assert.assertFalse("Returns that a later day is before an earlier one",testTask.isBefore(2, 1, 2013));
	} // End of testIsBefore() method.
	
	/**
	 * Tests the getAddress() method in the Task class.
	 */
	public void testGetAddress(){
		Assert.assertTrue("Location not returned when no address given", testTask2.getAddress()=="georgia tech");
		Assert.assertTrue("Proper address is not returned", testTask3.getAddress()=="6387 Aarons Way");
	} // End of testGetAddress() method.

} // End of TaskTest class.
